package com.cos.consumer;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.client.RestTemplate;

/**
 * @author: COS
 * @time: 2022/4/27 14:10
 * @description:
 */
@SpringBootApplication
@EnableEurekaClient
@EnableFeignClients//启动用Feign服务
@EnableCircuitBreaker //启动hystrix 服务
@EnableHystrixDashboard //开启hystrix的监控界面
// 在启动类上，添加扫描Servlet的注解
@ServletComponentScan("com.cos.consumer.servlet")
public class ConsumerApplication {
    public static void main(String[] args) {
        SpringApplication.run(ConsumerApplication.class, args);
    }

//    @Bean
//    @LoadBalanced
//    public RestTemplate returnRestTemplate() {
//        return new RestTemplate();
//    }

//    @Bean
//    public IRule robbinRule() {
//        return new RandomRule();
//    }
}
